/**
 * @ Author: luoqi
 * @ Create Time: 2023-12-22 10:07
 * @ Modified by: luoqi
 * @ Modified time: 2023-12-22 11:23
 * @ Description:
 */

#include "hypstersis_cmp.h"

int hyps_cmp_init(HypsCmpObj *hyps, float href, float lref)
{
    hyps->href = href;
    hyps->lref = lref;
    hyps->k1 = 0;
}

int hyps_cmp_calcu(HypsCmpObj *hyps, float k)
{
    if(k < hyps->lref){
        hyps->k1 = -1;
        return -1;
    }else if(k > hyps->href){
        hyps->k1 = 1;
        return 1;
    }else {
        return hyps->k1;
    }
}
